%h1 Dashboard 

- if @pushes
  %h2 Pushes Received
  .pushes
    %table
      %tr
        %th.side &nbsp;
        %th Date
        %th Status
        %th Commit
        %th Repository
        %th Branch
      - untracked_pushes = false
      - @pushes.each do |push|
        - untracked_pushes = untracked_pushes || !push.tracked?
        %tr{:class=>classes_for(push) << 'push'}
          %th.side Push
          %td
            =push.created_at.strftime("%B %d - %H:%M")
          %td
            =push.status
            - if push.tracked? && !push.deployed?
              %form{:method=>:post, :action=>'deploy'}
                %input{:type=>:hidden, :name=>:id, :value=>push.id}
                %input{:type=>:submit, :value=>:deploy}
            - elsif push.deployed?
              %form{:method=>:post, :action=>'undeploy'}
                %input{:type=>:hidden, :name=>:id, :value=>push.id}
                %input{:type=>:submit, :value=>:undeploy}
              - if push.deployment
                %span.deployment
                  %br
                  %a{:href=>push.deployment.context}
                    =push.deployment.context

          %td
            %a{:href=>push['compare']} 
              =push.short_commit_hash
          %td.repo
            %a{:href=>push.repo_url}
              =push.repo_name
          %td=push.branch
        - unless push['commits'].empty?
          %tr.commits{:class=>classes_for(push)}
            %th.side Commits
            %td{:colspan=>5}
              - push['commits'].each do |commit|
                %ul
                  %li=commit['author']['name']
                  %li
                    %a{:href=>commit['url']} 
                      =commit['id']
                  %li=commit['timestamp']
                  %li=commit['message']

  - if untracked_pushes
    %h2 Untracked Pushes
    You have some untracked pushes.
    %a{:href=>'#', :id=>'toggler'}
      Have a look &rarr;
    :javascript
      $('#toggler').click(function() { $('.ignored').toggle();return false; });
